

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>speechemotionrecognition package &mdash; Speech Emotion Recognition 1.0 documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script type="text/javascript" src="_static/jquery.js"></script>
        <script type="text/javascript" src="_static/underscore.js"></script>
        <script type="text/javascript" src="_static/doctools.js"></script>
        <script type="text/javascript" src="_static/language_data.js"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="speechemotionrecognition.dnn module" href="speechemotionrecognition.dnn.html" />
    <link rel="prev" title="speechemotionrecognition" href="modules.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="main.html" class="icon icon-home"> Speech Emotion Recognition
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">speechemotionrecognition</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">speechemotionrecognition package</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#submodules">Submodules</a><ul>
<li class="toctree-l4"><a class="reference internal" href="speechemotionrecognition.dnn.html">speechemotionrecognition.dnn module</a></li>
<li class="toctree-l4"><a class="reference internal" href="speechemotionrecognition.mlmodel.html">speechemotionrecognition.mlmodel module</a></li>
<li class="toctree-l4"><a class="reference internal" href="speechemotionrecognition.utilities.html">speechemotionrecognition.utilities module</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#module-speechemotionrecognition">Module contents</a></li>
</ul>
</li>
</ul>
</li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="main.html">Speech Emotion Recognition</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="main.html">Docs</a> &raquo;</li>
        
          <li><a href="modules.html">speechemotionrecognition</a> &raquo;</li>
        
      <li>speechemotionrecognition package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/speechemotionrecognition.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="speechemotionrecognition-package">
<h1>speechemotionrecognition package<a class="headerlink" href="#speechemotionrecognition-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="speechemotionrecognition.dnn.html">speechemotionrecognition.dnn module</a></li>
<li class="toctree-l1"><a class="reference internal" href="speechemotionrecognition.mlmodel.html">speechemotionrecognition.mlmodel module</a></li>
<li class="toctree-l1"><a class="reference internal" href="speechemotionrecognition.utilities.html">speechemotionrecognition.utilities module</a></li>
</ul>
</div>
</div>
<div class="section" id="module-speechemotionrecognition">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-speechemotionrecognition" title="Permalink to this headline">¶</a></h2>
<p>speechemotionrecognition module.
Provides a library to perform speech emotion recognition on <cite>emodb</cite> data set</p>
<dl class="class">
<dt id="speechemotionrecognition.Model">
<em class="property">class </em><code class="descclassname">speechemotionrecognition.</code><code class="descname">Model</code><span class="sig-paren">(</span><em>save_path: str = ''</em>, <em>name: str = 'Not Specified'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/speechemotionrecognition.html#Model"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#speechemotionrecognition.Model" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Model is the abstract class which determines how a model should be.
Any model inheriting this class should do the following.</p>
<ol class="arabic simple">
<li>Set the model instance variable to the corresponding model class which
which will provide methods <cite>fit</cite> and <cite>predict</cite>.</li>
<li>Should implement the following abstract methods <cite>load_model</cite>,
<cite>save_model</cite> <cite>train</cite> and <cite>evaluate</cite>. These methods provide the
functionality to save the model to the disk, load the model from the
disk and train the model and evaluate the model to return appropriate
measure like accuracy, f1 score, etc.</li>
</ol>
<dl class="attribute">
<dt id="speechemotionrecognition.Model.model">
<code class="descname">model</code><a class="headerlink" href="#speechemotionrecognition.Model.model" title="Permalink to this definition">¶</a></dt>
<dd><p>instance variable that holds the model.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">Any</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="speechemotionrecognition.Model.save_path">
<code class="descname">save_path</code><a class="headerlink" href="#speechemotionrecognition.Model.save_path" title="Permalink to this definition">¶</a></dt>
<dd><p>path to save the model.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">str</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="speechemotionrecognition.Model.name">
<code class="descname">name</code><a class="headerlink" href="#speechemotionrecognition.Model.name" title="Permalink to this definition">¶</a></dt>
<dd><p>name of the model.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">str</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="speechemotionrecognition.Model.trained">
<code class="descname">trained</code><a class="headerlink" href="#speechemotionrecognition.Model.trained" title="Permalink to this definition">¶</a></dt>
<dd><p>True if model has been trained, false otherwise.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Type:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="speechemotionrecognition.Model.__init__">
<code class="descname">__init__</code><span class="sig-paren">(</span><em>save_path: str = ''</em>, <em>name: str = 'Not Specified'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/speechemotionrecognition.html#Model.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#speechemotionrecognition.Model.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Default constructor for abstract class Model.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>save_path</strong> (<em>str</em>) – path to save the model to.</li>
<li><strong>name</strong> (<em>str</em>) – name of the model given as string.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="speechemotionrecognition.Model.evaluate">
<code class="descname">evaluate</code><span class="sig-paren">(</span><em>x_test: numpy.ndarray</em>, <em>y_test: numpy.ndarray</em><span class="sig-paren">)</span> &#x2192; None<a class="reference internal" href="_modules/speechemotionrecognition.html#Model.evaluate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#speechemotionrecognition.Model.evaluate" title="Permalink to this definition">¶</a></dt>
<dd><p>Evaluate the current model on the given test data.</p>
<p>Predict the labels for test data using the model and print the relevant
metrics like accuracy and the confusion matrix.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>x_test</strong> (<em>numpy.ndarray</em>) – Numpy nD array or a list like object
containing the samples.</li>
<li><strong>y_test</strong> (<em>numpy.ndarray</em>) – Numpy 1D array or list like object
containing the labels for test samples.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="speechemotionrecognition.Model.load_model">
<code class="descname">load_model</code><span class="sig-paren">(</span><em>to_load: str</em><span class="sig-paren">)</span> &#x2192; None<a class="reference internal" href="_modules/speechemotionrecognition.html#Model.load_model"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#speechemotionrecognition.Model.load_model" title="Permalink to this definition">¶</a></dt>
<dd><p>Load the weights from the given saved model.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>to_load</strong> – path containing the saved model.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="speechemotionrecognition.Model.predict">
<code class="descname">predict</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/speechemotionrecognition.html#Model.predict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#speechemotionrecognition.Model.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>Predict labels for given data.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>samples</strong> (<em>numpy.ndarray</em>) – data for which labels need to be predicted</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of labels predicted for the data.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="speechemotionrecognition.Model.predict_one">
<code class="descname">predict_one</code><span class="sig-paren">(</span><em>sample: numpy.ndarray</em><span class="sig-paren">)</span> &#x2192; int<a class="reference internal" href="_modules/speechemotionrecognition.html#Model.predict_one"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#speechemotionrecognition.Model.predict_one" title="Permalink to this definition">¶</a></dt>
<dd><p>Predict label of a single sample. The reason this method exists is
because often we might want to predict label for a single sample.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>sample</strong> (<em>numpy.ndarray</em>) – Feature vector of the sample that we want to
predict the label for.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">returns the label for the sample.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">int</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="speechemotionrecognition.Model.restore_model">
<code class="descname">restore_model</code><span class="sig-paren">(</span><em>load_path: str = None</em><span class="sig-paren">)</span> &#x2192; None<a class="reference internal" href="_modules/speechemotionrecognition.html#Model.restore_model"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#speechemotionrecognition.Model.restore_model" title="Permalink to this definition">¶</a></dt>
<dd><p>Restore the weights from a saved model and load them to the model.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>load_path</strong> (<em>str</em>) – Optional, path to load the weights from a given path.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="speechemotionrecognition.Model.save_model">
<code class="descname">save_model</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="reference internal" href="_modules/speechemotionrecognition.html#Model.save_model"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#speechemotionrecognition.Model.save_model" title="Permalink to this definition">¶</a></dt>
<dd><p>Save the model to path denoted by <cite>save_path</cite> instance variable.</p>
</dd></dl>

<dl class="method">
<dt id="speechemotionrecognition.Model.train">
<code class="descname">train</code><span class="sig-paren">(</span><em>x_train: numpy.ndarray</em>, <em>y_train: numpy.ndarray</em>, <em>x_val: numpy.ndarray = None</em>, <em>y_val: numpy.ndarray = None</em><span class="sig-paren">)</span> &#x2192; None<a class="reference internal" href="_modules/speechemotionrecognition.html#Model.train"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#speechemotionrecognition.Model.train" title="Permalink to this definition">¶</a></dt>
<dd><p>Trains the model with the given training data.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>x_train</strong> (<em>numpy.ndarray</em>) – samples of training data.</li>
<li><strong>y_train</strong> (<em>numpy.ndarray</em>) – labels for training data.</li>
<li><strong>x_val</strong> (<em>numpy.ndarray</em>) – Optional, samples in the validation data.</li>
<li><strong>y_val</strong> (<em>numpy.ndarray</em>) – Optional, labels of the validation data.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="speechemotionrecognition.dnn.html" class="btn btn-neutral float-right" title="speechemotionrecognition.dnn module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="modules.html" class="btn btn-neutral float-left" title="speechemotionrecognition" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, Hemanth Kumar Veeranki

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>